﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>SSE Data Stream Example</title>
</head>
<body>
    <ul id="dataItems"></ul>

    <script>
        const eventSource = new EventSource('https://localhost:7028/WeatherForecast/GetStream');

        eventSource.onmessage = function(event) {
            const data = event.data;
            const listItem = document.createElement('li');
            listItem.textContent = data;
            document.getElementById('dataItems').appendChild(listItem);
        };

        eventSource.onerror = function(error) {
            console.error('EventSource failed:', error);
        };
    </script>
</body>
</html>